package NewCoder;

public class BM14 {
    public ListNode oddEvenList (ListNode head) {
        // write code here
        if(head==null || head.next==null) return head;
        ListNode node1=head;
        ListNode node2=head.next;
        ListNode node3=node2;
        while(node3!=null && node3.next!=null){
            node1.next=node3.next;
            node1=node1.next;
            node3.next=node1.next;
            node3=node3.next;
        }
        node1.next=node2;
        return head;
    }
}
